package core.hxl.controller;

import core.hxl.dao.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api")
public class ApiController {

    /*
    * 动态刷新 要手动调用 http://localhost:10002/refresh POST方法
    * */
    @Autowired
    private User user;

    /**
     * 返回配置文件中的值
     */
    @GetMapping("/from")
    public String returnFormValue(){
        return user.toString();
    }

    @RequestMapping(value = "/service/{name}")
    public String feign(@PathVariable("name") String name){
        return "fegin_service:"+name;
    }

    @RequestMapping(value = "/service1")
    public String feign1(@RequestParam("name") String name){
        return "fegin_service1:"+name;
    }


}
